{{ template "header" . }}
	<div class="layui-container index">
		<div class="space-left">
			{{ template "user-nav-left" . }}
		</div>
		<div class="space-right">
			<!-- 个人信息 -->
			<div class="space-box space-userinfo">
				<div class="space-title">
					我的好友
				</div>
				<div class="space-info">
					<div class="list">
						{{ if .list }}
							{{ range .list }}
							<div class="layui-row">
								<div class="layui-col-md9">
									<a href="/space/{{ .SendUid }}">
										<img style="width:25px;border-radius: 50%;margin-right: 7px;" src="{{ .Avatar }}">
									</a>
									{{ .Name }}
								</div>
								<div class="layui-col-md3">
									<span class="accept layui-btn layui-btn-success layui-btn-sm" data-id="{{ .Id }}" data-status="1">发消息</span>
									<span class="accept layui-btn layui-btn-danger layui-btn-sm" data-status="2">删除好友</span>
								</div>
							</div>
							{{ end }}
						{{ else }}
							<div class="layui-row">
								<div class="layui-col-md12" style="text-align:left">
									您的好友列表是空的，赶紧去<a href="/">添加</a>几个好友吧
								</div>
							</div>
						{{ end }}
					</div>
				</div>
			</div>
		</div>
	</div>
{{ template "footer" . }}
<script>
	//Demo
	layui.use('form', function(){
		$('.accept').click(function(){
			let id = $(this).attr('data-id') , status = $(this).attr('data-status')
			if (id && status) {
				$.post('/accept' , {id : id , status : status} , function(data){
					if (data.status) {
                        layer.msg(data.msg)
                        return;
                    }
                    layer.msg(data.msg);
                    setTimeout(function(){
                    	window.location.reload();
                    } , 1500)
				})
			}
		})
	});
</script>